#include "adc_app.h"

uint32_t adc_buffer[30];
float adc_value;
void adc_proc(void)
{
	for(int i=0;i<30;i++)
	{
		adc_value += adc_buffer[i];
	}
	adc_value /= 30.0f;
	adc_value = adc_value /4096.0f * 3.3f;

	if(adc_value <1)
		data1.temp = 20.0;
	else if(adc_value >= 1 && adc_value <= 3)
		data1.temp = 10.0f * adc_value + 10;
	else if(adc_value > 3)
		data1.temp = 40.0;

		if(!data1.mode)
		{
			if (data1.temp < 25)
				data1.GEAR = 1;
			else if (data1.temp >= 25 && data1.temp <= 30)
				data1.GEAR = 2;
			else if (data1.temp > 30)
				data1.GEAR = 3;
		}

}